package com.cnhis.cloudhealth.clidoctorweb.clidiseasereference;

import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;

import org.jboss.resteasy.logging.Logger;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Reference;
import com.cnhis.cloudhealth.clinical.clidoctor.clidiseasereference.service.ICliDiseaseReference;
import com.cnhis.cloudhealth.commons.Mappers.ModelVo;
import java.util.HashMap;

@Path("clidiseasereference")
@Component
public class CliDiseaseReferenceRest {
	Logger log = Logger.getLogger(CliDiseaseReferenceRest.class);
	  @Reference
	  private ICliDiseaseReference cliDiseaseReference;
	  /* ScriptId(1773) */
	  /* Description(诊疗药品参考分类 树形左边列表) */
	  /**
	   * 
	   * @param lType 6西医诊断 7 中医诊断  1-5 诊疗药品
	   * @return
	   * @throws Exception
	   */
	    @GET
		@Path("diseasetree")
		@Produces({ MediaType.APPLICATION_JSON })
		@SuppressWarnings("unchecked")
	  public ModelVo diseaseTree(@QueryParam("lType") int lType)throws Exception{
		  HashMap map = new HashMap();
		  map.put("lType", lType);
		  return cliDiseaseReference.diseaseTree(map);
	  }
	    
	    /* ScriptId(2031) */
	    /* Description(诊疗药品参考内容) */
	    /**
	     * 
	     * @param ltype 1 疾病 0 药品
	     * @param BCW01 疾病id
	     * @return
	     * @throws Exception
	     */
	        @POST
	  		@Path("diseasereferencecontent")
	  		@Produces({ MediaType.APPLICATION_JSON })
	  		@SuppressWarnings("unchecked")
	    public ModelVo diseaseReferenceContent(@FormParam("ltype") int ltype,@FormParam("BCW01") int BCW01)throws Exception{
	        	 HashMap map = new HashMap();
	   		    map.put("ltype", ltype);
	   		   map.put("BCW01", BCW01);
	   		  return cliDiseaseReference.diseaseReferenceContent(map);
	    }
	        /* ScriptId(2047) */
	        /* Description(诊疗药品参考目录检索) */
	        /**
	         * 
	         * @param ltype 0 药品  1疾病
	         * @param lTxt 关键字
	         * @param currPage
	         * @param pageSize
	         * @return
	         * @throws Exception
	         */
	        @POST
	  		@Path("directorysearch")
	  		@Produces({ MediaType.APPLICATION_JSON })
	        @SuppressWarnings("unchecked")
			public ModelVo directorySearch(@FormParam("ltype") int ltype,@FormParam("lTxt") String lTxt
	        		,@FormParam("currPage") int currPage,@FormParam("pageSize") int pageSize
	        		)throws Exception{
	        	 HashMap map = new HashMap();
		   		    map.put("ltype", ltype);
		   		   map.put("lTxt", "%"+lTxt+"%");
		   		  return cliDiseaseReference.directorySearch(map,(currPage-1)*pageSize,pageSize);
	        }
}
